<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <table border="1">
    <caption>员工列表</caption>
    <tr><th>编号</th><th>姓名</th><th>姓名工资</th><th>工作</th><th>操作</th></tr>
      //i代表当前数组元素的下标
      <tr v-for="(e,i) in arr">
          <td>{{i+1}}</td>
          <td>{{e.name}}</td>
          <td>{{e.salary}}</td>
          <td>{{e.job}}</td>
          //                                         i代表需要删除元素的下标
          <td><input type="button" value="删除" @click="del(i)"></td>
      </tr>
  </table>
  <input type="text" placeholder="姓名" v-model="emp.name">
  <input type="text" placeholder="工资" v-model="emp.salary">
  <input type="text" placeholder="工作" v-model="emp.job">
  <input type="button" value="添加员工" @click="f()">
</div>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script>
  let v = new Vue({
    el:"body>div",
    data:{
        arr:[],
        emp:{name:"",salary:"",job:""}
    },
    methods:{
        f(){
            v.arr.push({
                name:v.emp.name,
                salary:v.emp.salary,
                job:v.emp.job
            })
        },
        del(i){
            v.arr.splice(i,1);
        }
    }
  })
</script>
</body>
</html>